package com.zhx.learn.quartz.schedule;

import com.zhx.learn.quartz.entity.SaveJob;
import com.zhx.learn.quartz.res.SaveJobDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * describe:测试的定时任务工作类
 *
 * @author zhanghaixuan
 * @date 2018/08/06
 **/
@Component("testTask")
public class TestTask{

	private final static String port = "8081";

	private Integer num = 0;

	@Autowired
	private SaveJobDao saveJobDao;

    public void testNoParams(){
        System.out.println("执行无参方法"+port);

		SaveJob saveJob = new SaveJob();
		saveJob.setUser(port);
		saveJob.setTime(new Date());
		saveJob.setValue(num.toString());

		saveJobDao.save(saveJob);

		num++;
    }
}
